var unit = require('../../../common/script/util');
var app = getApp();
Page({
    data: {
        unitPrice: 0,
        totalPrice: 0,
        loading: true,
        btnDis: true
    },
    onLoad: function onLoad(options) {
        var params = JSON.parse(options.params);
        var that = this;
        wx.request({
            url: 'http://localhost:8080/wxAppletOpportunity/queryPrice',
            data: {
                city: params.city,
                district: params.district,
                projectName: params.projectName,
                building: params.building,
                unit: params.unit,
                floor: params.floor,
                totalFloor: params.totalFloor,
                roomNumber: params.roomNumber,
                area: params.area,
                address: params.address,
                orientation: params.orientation,
                houseType: params.houseType,
                assetType: params.assetType,
                specialFactors: params.specialFactors,
                openId: app.globalData.openId,
                requestStartTime: unit.formatTime(new Date())
            },
            method: 'POST',
            header: {
                'content-type': 'application/json'
            },
            complete: function complete(res) {
                if (res.statusCode == 200) {
                    that.setData({
                        unitPrice: res.data.unitPrice,
                        totalPrice: res.data.totalPrice,
                        loading: false,
                        btnDis: false
                    });
                } else {
                    console.log(res.data.errorMessage);
                }
            }
        });
    },
    backToCreateStep1: function backToCreateStep1() {
        wx.navigateBack({
            delta: getCurrentPages().length - 1
        });
    }
});